package com.xz.realdemo.model;

import java.io.*;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     DateChart   
 * @package    com.xz.realdemo.model  
 * @date   2019/12/2 15:01  
 * @explain
 */
public class DataChart implements Serializable{

    private String id;
    private String color;
    private DataSet dataSet;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public DataSet getDataSet() {
        return dataSet;
    }

    public void setDataSet(DataSet dataSet) {
        this.dataSet = dataSet;
    }

    @Override
    public String toString() {
        return "DataChart{" +
                "id='" + id + '\'' +
                ", color='" + color + '\'' +
                ", dataSet=" + dataSet +
                '}';
    }


    public DataChart copy() throws IOException, ClassNotFoundException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(this);

        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        return (DataChart) ois.readObject();
    }
}
